<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
<script>
    function Hash(){
        this.table=new Array(137);
    }
    Hash.prototype={
        simpleHash: function (str) {
            const H=37;
            var total= 0,size=str.length;
            while(size--){
                total+=H*total+str.charCodeAt(size);
            }
            return total % this.table.length;
        },
        show: function () {
            console.info('show data:',this.table);
        },
        put: function (data) {
            var pos=this.simpleHash(data);
            this.table[pos]=data;
        },
        get: function () {

        }
    }

    var hash=new Hash();
    var names=["David", "Jennifer", "Donnie", "Raymond","Cynthia", "Mike", "Clayton", "Danny", "Jonathan"];
    for(var i= 0;i<names.length;i++){
        hash.put(names[i]);
    }
    hash.show();

</script>
</body>
</html>